<?php

class User_model extends CI_Model
{
	public function __construct()
	{
		$this->load->database();
		$this->load->helper('date');
	}

	public function check_diner($loginID, $password)
	{
		$password = substr(hash('sha256', $password), 32);
		$result = $this->db->query("SELECT * FROM diner WHERE (uname='$loginID' OR phone_number='$loginID') AND passwd='$password'")->result();
		if($result){
			return $result;
		}else{
			return false;
		}
	}

	public function check_rider($loginID, $password)
	{
		$password = substr(hash('sha256', $password), 32);
		$result = $this->db->query("SELECT * FROM rider WHERE (id='$loginID' OR phone_number='$loginID') AND passwd='$password'")->result();
		if($result){
			return $result;
		}else{
			return false;
		}
	}
}
